<template>
  <div class="ad-box" :style="{ top: top, left: left }">
    <div class="item-img" v-for="(item, index) in userStore.websiteInfo.leftAd" :key="index"  @click="handleClick(item[1])">
        <img :src="item[0]" alt="">
    </div>
    
  </div>
</template>

<script setup>
import useUserStore from '@/store/modules/user'
const userStore = useUserStore();

 defineProps({
    top: {
        type: String,
        default: 0
    },
    left: {
        type: String,
        default: 0
    }
 })

 const handleClick = (url) => {
    window.open(url)
 }

</script>

<style lang="scss" scoped>
    .ad-box {
        position: absolute;
        z-index: 10;
        width: 150px;
        height: auto;
        .item-img {
            width: 100%;
            height: auto;
            cursor: pointer;
            &:not(:last-child) {
                margin-bottom: 30px;
            }
        }
    }
</style>